var cc__decorate = __decorate;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var $2ADManager = require("ADManager");
var $2UIManager = require("UIManager");
var $2BundleManager = require("BundleManager");
var cc__decorator = cc._decorator;
var ccp_ccclass = cc__decorator.ccclass;
var ccp_property = cc__decorator.property;
var def_RecordUI = /* */function (_cc$Component60) {
  babel_inherits(c, _cc$Component60);
  var _super76 = babel_createSuper(c);
  function c() {
    var _this172;
    babel_classCallCheck(this, c);
    _this172 = _super76.apply(this, arguments);
    _this172.isRecord = false;
    _this172.play = null;
    return _this172;
  }
  babel_createClass(c, [{
    key: "onLoad",
    value: function onLoad() {
      this.play = cc.find("play", this.node);
      this.play.on(cc.Node.EventType.TOUCH_END, this.onClickRecord, this);
    }
  }, {
    key: "onClickRecord",
    value: function onClickRecord() {
      if (this.isRecord) {
        this.isRecord = false;
        this.endTime = new Date().getTime();
        if (this.endTime - this.startTime >= 3e3) {
          $2ADManager.default.instance.recorderStop();
        } else {
          $2UIManager.default.instance.showToast("录屏时长小于3秒");
        }
        this.node.getComponentInChildren(cc.Sprite).spriteFrame = $2BundleManager.default.instance.getBundleRes("BundleTexture", "ShareUI/play", cc.SpriteFrame);
        this.node.children[2].active = false;
        this.node.getComponentInChildren(cc.Label).string = "开始录屏";
      } else {
        this.isRecord = true;
        $2ADManager.default.instance.recorderStart();
        this.startTime = new Date().getTime();
        this.node.getComponentInChildren(cc.Sprite).spriteFrame = $2BundleManager.default.instance.getBundleRes("BundleTexture", "ShareUI/pause", cc.SpriteFrame);
        this.node.getComponentInChildren(cc.Label).string = "停止录屏";
        this.node.children[2].active = true;
      }
    }
  }]);
  return c;
}(cc.Component);
def_RecordUI = cc__decorate([ccp_ccclass], def_RecordUI);
exports.default = def_RecordUI;